//Download by http://www.NewXing.com
// ListBoxSocInfo.cpp : implementation file
//

#include "stdafx.h"
#include "LeoBlock2004.h"
#include "ListBoxSocInfo.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CListBoxSocInfo

CListBoxSocInfo::CListBoxSocInfo()
{
	/*m_newFont.CreateFont(2,2,0,0,1,FALSE,FALSE,FALSE,DEFAULT_CHARSET,
				OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
				FIXED_PITCH|FF_MODERN,"System");
	n_Count=0;*/
	m_brHollow.CreateSolidBrush(RGB(255,255,255));
	
	m_nMaxWidth=0;

}

CListBoxSocInfo::~CListBoxSocInfo()
{
}


BEGIN_MESSAGE_MAP(CListBoxSocInfo, CListBox)
	//{{AFX_MSG_MAP(CListBoxSocInfo)
	ON_WM_CTLCOLOR_REFLECT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CListBoxSocInfo message handlers
int CListBoxSocInfo::AddString(LPCTSTR lpszItem)
{
	int nRet=CListBox::AddString(lpszItem);

	/*SCROLLINFO scrollInfo;
    memset(&scrollInfo, 0, sizeof(SCROLLINFO));
    scrollInfo.cbSize = sizeof(SCROLLINFO);
    scrollInfo.fMask  = SIF_ALL;
    GetScrollInfo(SB_VERT, &scrollInfo, SIF_ALL);
	int nScrollWidth = 0;
    if(GetCount() > 1 && ((int)scrollInfo.nMax >= (int)scrollInfo.nPage))
    {
       nScrollWidth = GetSystemMetrics(SM_CXVSCROLL);
    }

	//DC
	SIZE      sSize;
    //CClientDC myDC(this);
	CDC *myDC=GetDC();
	
	CFont* pListBoxFont = GetFont();
    if(pListBoxFont != NULL)
    {
        CFont* pOldFont=myDC->SelectObject(pListBoxFont);
		GetTextExtentPoint32(myDC->m_hDC,lpszItem, strlen(lpszItem),&sSize);
        m_nMaxWidth = max(m_nMaxWidth, (int)sSize.cx);
		SetHorizontalExtent(m_nMaxWidth + 3);
		myDC->SelectObject(pOldFont);
	}*/

	return nRet;
}

HBRUSH CListBoxSocInfo::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	// TODO: Change any attributes of the DC here
	pDC->SetBkMode(TRANSPARENT);
	pDC->SetTextColor(RGB(0,0,100));
	// TODO: Return a non-NULL brush if the parent's handler should not be called
	return m_brHollow;
}

